Hi there,
I have an abstract class called Position that maps to the persistence layer. The database table (and mutator/descriptor) has field for the position description, the fully-qualified-name of the sub-class and encoded (base64) definition. The definition field is a text data type, so that each sub-class of Position (e.g.: GpsPosition) will populate the definition field as it is filled in.
The purpose of this is so that any type of Position sub-class with any number of fields (and data types) can be encoded/decoded into a string/xml representation and saved in the standardized persistence layer. E.g.: Gps has Latitude/Longitude fields and encodes to the single text database fields, RDBMS has TableName/PrimaryKeyFieldName/PrimaryKeyId fields that encode to the single text database field. etc.
I want to have the generic Position table associated to a configuration page. A drop list of Position sub-classes will be populated with the available type of position that can be selected by using reflection for the sub-classes that extend the Position abstract class.
My question: Does anyone have a suggested solution for dynamically creating the fields on the page according to the fields. My initial thoughts are that I'll have to use a Custom Unit that will return a purpose-specific bean containing the encoded class. The javascript will have to interrogate the class and the unit.template will have to dynamically create the html form on the page.
If I get this working and create a design pattern of "description, FQN, encodedDefinition" would that be of use to others?